package com.atguigu.eduservice.controller;


import com.atguigu.commonutils.R;
import com.atguigu.eduservice.entity.EduSubject;
import com.atguigu.eduservice.entity.subject.OneSubject;
import com.atguigu.eduservice.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-11-16
 */
@RestController
@RequestMapping("/eduservice/edusubject")

public class EduSubjectController {

    @Autowired
    EduSubjectService subjectService;

    //添加课程分类
    @PostMapping("addSubjiect")
    public R addSujict(MultipartFile file){
        subjectService.saveSubject(file,subjectService);
        return R.ok();
    }

    //课程分类的列表功能(树形)
    @GetMapping("getAllSubject")
    public R getAllSubject(){
        List<OneSubject> list =  subjectService.getAllOneTwoSubject();
       return R.ok().data("list",list);
    }


}

